package com.zx.yixun.ui.adapter;

import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zx.yixun.R;
import com.zx.yixun.data.LineDatabean;

public class LineBottomAdapter extends BaseQuickAdapter<LineDatabean, BaseViewHolder> {
    public LineBottomAdapter() {
        super(R.layout.item_linebottom);
    }

    @Override
    protected void convert(BaseViewHolder helper, LineDatabean item) {
        ImageView iv_device = helper.getView(R.id.iv_device);
        ImageView iv_hhz = helper.getView(R.id.iv_hhz);
        if (item.getTypeId()==8){
            iv_device.setVisibility(View.VISIBLE);
            if ("人工".equals(item.getCollectorName())){
                switch (item.getDeviceStatus()){
                    case "1"://运行
                        iv_device.setImageResource(R.mipmap.rgz_normal_bottom);
                        break;
                    case "2":
                        iv_device.setImageResource(R.mipmap.rgz_error_bottom);
                        break;
                    case "3":

                        break;
                    case "4":
                        iv_device.setImageResource(R.mipmap.rgz_leaveline_bottom);
                        break;
                    case "5":
                        iv_device.setImageResource(R.mipmap.rgz_leaveline_bottom);
                        break;
                    default:
                        iv_device.setImageResource(R.mipmap.rgz_leaveline_bottom);
                        break;
                }
            }else {
                switch (item.getDeviceStatus()){
                    case "1"://运行
                        iv_device.setImageResource(R.mipmap.device_normal_bottom);
                        break;
                    case "2":
                        iv_device.setImageResource(R.mipmap.device_error_bottom);
                        break;
                    case "3":

                        break;
                    case "4":
                        iv_device.setImageResource(R.mipmap.device_leaveline_bottom);
                        break;
                    case "5":
                        iv_device.setImageResource(R.mipmap.device_leaveline_bottom);
                        break;
                    default:
                        iv_device.setImageResource(R.mipmap.device_leaveline_bottom);
                        break;
                }

            }
        }else {
            iv_device.setVisibility(View.GONE);
        }


        switch (item.isFault()){
            case "3":
                iv_hhz.setImageResource(R.mipmap.hhz_normal);
                break;
            case "4":
                iv_hhz.setImageResource(R.mipmap.hhz_busy);
                break;
            case "5":
                iv_hhz.setImageResource(R.mipmap.hhz_normal);
                break;
            case "6":
                iv_hhz.setImageResource(R.mipmap.hhz_error);
                break;
            default:
                iv_hhz.setImageResource(R.mipmap.hhz_normal);
                break;


        }


    }
}
